local sk__quanheng = fk.CreateSkill {

  name = "sk__quanheng",

  tags = {  },

}



sk__quanheng:addEffect("viewas", {
  name = "sk__quanheng",
  prompt = "#sk__quanheng",
  interaction = function()
    return UI.ComboBox {choices = {"ex_nihilo", "slash"}}
  end,
  card_filter = function(self, player, to_select, selected)
    return Fk:currentRoom():getCardArea(to_select) ~= Card.PlayerEquip
  end,
  view_as = function(self, player,cards)
    if #cards == 0 or not self.interaction.data then return end
    local card = Fk:cloneCard(self.interaction.data)
    card.skillName = sk__quanheng.name
    card:addSubcards(cards)
    return card
  end,
  before_use = function (self, player, use)
    use.extraUse = true
    use.extra_data = use.extra_data or {}
    use.extra_data.sk__quanheng = {player.id, #use.card.subcards}
  end,
  enabled_at_play = function (self, player)
    return player:usedSkillTimes(sk__quanheng.name, Player.HistoryPhase) == 0
  end,
})

sk__quanheng:addEffect(fk.CardEffectCancelledOut, {
  name = "#sk__quanheng_delay",
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return target == player and not player.dead and data.extra_data and data.extra_data.sk__quanheng and
      data.extra_data.sk__quanheng[1] == player.id
  end,
  on_cost = Util.TrueFunc,
  on_use = function(self, event, target, player, data)
    player:drawCards(data.extra_data.sk__quanheng[2], "sk__quanheng")
  end,
})

return sk__quanheng